\(\int \sqrt {-1+\cot ^2(x)} \, dx\) [42]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [C] (verification not implemented)
   Giac [F(-1)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 42 \[ \int \sqrt {-1+\cot ^2(x)} \, dx=-\text {arctanh}\left (\frac {\cot (x)}{\sqrt {-1+\cot ^2(x)}}\right )+\sqrt {2} \text {arctanh}\left (\frac {\sqrt {2} \cot (x)}{\sqrt {-1+\cot ^2(x)}}\right ) \]

[Out]

-arctanh(cot(x)/(-1+cot(x)^2)^(1/2))+arctanh(cot(x)*2^(1/2)/(-1+cot(x)^2)^(1/2))*2^(1/2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3742, 399, 223, 212, 385} \[ \int \sqrt {-1+\cot ^2(x)} \, dx=\sqrt {2} \text {arctanh}\left (\frac {\sqrt {2} \cot (x)}{\sqrt {\cot ^2(x)-1}}\right )-\text {arctanh}\left (\frac {\cot (x)}{\sqrt {\cot ^2(x)-1}}\right ) \]

[In]

Int[Sqrt[-1 + Cot[x]^2],x]

[Out]

-ArcTanh[Cot[x]/Sqrt[-1 + Cot[x]^2]] + Sqrt[2]*ArcTanh[(Sqrt[2]*Cot[x])/Sqrt[-1 + Cot[x]^2]]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 223

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a,
b}, x] &&  !GtQ[a, 0]

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 399

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Dist[b/d, Int[(a + b*x^n)^(p - 1), x]
, x] - Dist[(b*c - a*d)/d, Int[(a + b*x^n)^(p - 1)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, p}, x] && NeQ[b*c
 - a*d, 0] && EqQ[n*(p - 1) + 1, 0] && IntegerQ[n]

Rule 3742

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[c*(ff/f), Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {\sqrt {-1+x^2}}{1+x^2} \, dx,x,\cot (x)\right ) \\ & = 2 \text {Subst}\left (\int \frac {1}{\sqrt {-1+x^2} \left (1+x^2\right )} \, dx,x,\cot (x)\right )-\text {Subst}\left (\int \frac {1}{\sqrt {-1+x^2}} \, dx,x,\cot (x)\right ) \\ & = 2 \text {Subst}\left (\int \frac {1}{1-2 x^2} \, dx,x,\frac {\cot (x)}{\sqrt {-1+\cot ^2(x)}}\right )-\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\frac {\cot (x)}{\sqrt {-1+\cot ^2(x)}}\right ) \\ & = -\text {arctanh}\left (\frac {\cot (x)}{\sqrt {-1+\cot ^2(x)}}\right )+\sqrt {2} \text {arctanh}\left (\frac {\sqrt {2} \cot (x)}{\sqrt {-1+\cot ^2(x)}}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.09 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.43 \[ \int \sqrt {-1+\cot ^2(x)} \, dx=\frac {\sqrt {-1+\cot ^2(x)} \left (-\text {arctanh}\left (\frac {\cos (x)}{\sqrt {\cos (2 x)}}\right )+\sqrt {2} \log \left (\sqrt {2} \cos (x)+\sqrt {\cos (2 x)}\right )\right ) \sin (x)}{\sqrt {\cos (2 x)}} \]

[In]

Integrate[Sqrt[-1 + Cot[x]^2],x]

[Out]

(Sqrt[-1 + Cot[x]^2]*(-ArcTanh[Cos[x]/Sqrt[Cos[2*x]]] + Sqrt[2]*Log[Sqrt[2]*Cos[x] + Sqrt[Cos[2*x]]])*Sin[x])/
Sqrt[Cos[2*x]]

Maple [A] (verified)

Time = 0.03 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.83

method result size
derivativedivides \(-\ln \left (\cot \left (x \right )+\sqrt {-1+\cot \left (x \right )^{2}}\right )+\operatorname {arctanh}\left (\frac {\cot \left (x \right ) \sqrt {2}}{\sqrt {-1+\cot \left (x \right )^{2}}}\right ) \sqrt {2}\) \(35\)
default \(-\ln \left (\cot \left (x \right )+\sqrt {-1+\cot \left (x \right )^{2}}\right )+\operatorname {arctanh}\left (\frac {\cot \left (x \right ) \sqrt {2}}{\sqrt {-1+\cot \left (x \right )^{2}}}\right ) \sqrt {2}\) \(35\)

[In]

int((-1+cot(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-ln(cot(x)+(-1+cot(x)^2)^(1/2))+arctanh(cot(x)*2^(1/2)/(-1+cot(x)^2)^(1/2))*2^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 123 vs. \(2 (34) = 68\).

Time = 0.29 (sec) , antiderivative size = 123, normalized size of antiderivative = 2.93 \[ \int \sqrt {-1+\cot ^2(x)} \, dx=\frac {1}{2} \, \sqrt {2} \log \left (-2 \, \sqrt {-\frac {\cos \left (2 \, x\right )}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) - 2 \, \cos \left (2 \, x\right ) - 1\right ) - \frac {1}{2} \, \log \left (\frac {\sqrt {2} \sqrt {-\frac {\cos \left (2 \, x\right )}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) + \cos \left (2 \, x\right ) + 1}{\cos \left (2 \, x\right ) + 1}\right ) + \frac {1}{2} \, \log \left (\frac {\sqrt {2} \sqrt {-\frac {\cos \left (2 \, x\right )}{\cos \left (2 \, x\right ) - 1}} \sin \left (2 \, x\right ) - \cos \left (2 \, x\right ) - 1}{\cos \left (2 \, x\right ) + 1}\right ) \]

[In]

integrate((-1+cot(x)^2)^(1/2),x, algorithm="fricas")

[Out]

1/2*sqrt(2)*log(-2*sqrt(-cos(2*x)/(cos(2*x) - 1))*sin(2*x) - 2*cos(2*x) - 1) - 1/2*log((sqrt(2)*sqrt(-cos(2*x)
/(cos(2*x) - 1))*sin(2*x) + cos(2*x) + 1)/(cos(2*x) + 1)) + 1/2*log((sqrt(2)*sqrt(-cos(2*x)/(cos(2*x) - 1))*si
n(2*x) - cos(2*x) - 1)/(cos(2*x) + 1))

Sympy [F]

\[ \int \sqrt {-1+\cot ^2(x)} \, dx=\int \sqrt {\cot ^{2}{\left (x \right )} - 1}\, dx \]

[In]

integrate((-1+cot(x)**2)**(1/2),x)

[Out]

Integral(sqrt(cot(x)**2 - 1), x)

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.69 (sec) , antiderivative size = 941, normalized size of antiderivative = 22.40 \[ \int \sqrt {-1+\cot ^2(x)} \, dx=\text {Too large to display} \]

[In]

integrate((-1+cot(x)^2)^(1/2),x, algorithm="maxima")

[Out]

1/2*sqrt(2)*arcsinh(1) + 1/4*sqrt(2)*log(cos(2*x)^2 + sin(2*x)^2 + sqrt(cos(4*x)^2 + sin(4*x)^2 + 2*cos(4*x) +
 1)*(cos(1/2*arctan2(sin(4*x), cos(4*x) + 1))^2 + sin(1/2*arctan2(sin(4*x), cos(4*x) + 1))^2) + 2*(cos(4*x)^2
+ sin(4*x)^2 + 2*cos(4*x) + 1)^(1/4)*(cos(2*x)*cos(1/2*arctan2(sin(4*x), cos(4*x) + 1)) + sin(2*x)*sin(1/2*arc
tan2(sin(4*x), cos(4*x) + 1)))) - 1/2*log((sqrt(abs(2*e^(2*I*x) - 2)^4 + 16*cos(2*x)^4 + 16*sin(2*x)^4 + 8*(co
s(2*x)^2 - sin(2*x)^2 + 2*cos(2*x) + 1)*abs(2*e^(2*I*x) - 2)^2 + 64*cos(2*x)^3 + 32*(cos(2*x)^2 + 2*cos(2*x) +
 1)*sin(2*x)^2 + 96*cos(2*x)^2 + 64*cos(2*x) + 16)*cos(1/2*arctan2(8*(cos(2*x) + 1)*sin(2*x)/abs(2*e^(2*I*x) -
 2)^2, (abs(2*e^(2*I*x) - 2)^2 + 4*cos(2*x)^2 - 4*sin(2*x)^2 + 8*cos(2*x) + 4)/abs(2*e^(2*I*x) - 2)^2))^2 + sq
rt(abs(2*e^(2*I*x) - 2)^4 + 16*cos(2*x)^4 + 16*sin(2*x)^4 + 8*(cos(2*x)^2 - sin(2*x)^2 + 2*cos(2*x) + 1)*abs(2
*e^(2*I*x) - 2)^2 + 64*cos(2*x)^3 + 32*(cos(2*x)^2 + 2*cos(2*x) + 1)*sin(2*x)^2 + 96*cos(2*x)^2 + 64*cos(2*x)
+ 16)*sin(1/2*arctan2(8*(cos(2*x) + 1)*sin(2*x)/abs(2*e^(2*I*x) - 2)^2, (abs(2*e^(2*I*x) - 2)^2 + 4*cos(2*x)^2
 - 4*sin(2*x)^2 + 8*cos(2*x) + 4)/abs(2*e^(2*I*x) - 2)^2))^2 + 4*(abs(2*e^(2*I*x) - 2)^4 + 16*cos(2*x)^4 + 16*
sin(2*x)^4 + 8*(cos(2*x)^2 - sin(2*x)^2 + 2*cos(2*x) + 1)*abs(2*e^(2*I*x) - 2)^2 + 64*cos(2*x)^3 + 32*(cos(2*x
)^2 + 2*cos(2*x) + 1)*sin(2*x)^2 + 96*cos(2*x)^2 + 64*cos(2*x) + 16)^(1/4)*(cos(2*x) + 1)*cos(1/2*arctan2(8*(c
os(2*x) + 1)*sin(2*x)/abs(2*e^(2*I*x) - 2)^2, (abs(2*e^(2*I*x) - 2)^2 + 4*cos(2*x)^2 - 4*sin(2*x)^2 + 8*cos(2*
x) + 4)/abs(2*e^(2*I*x) - 2)^2)) + 4*(abs(2*e^(2*I*x) - 2)^4 + 16*cos(2*x)^4 + 16*sin(2*x)^4 + 8*(cos(2*x)^2 -
 sin(2*x)^2 + 2*cos(2*x) + 1)*abs(2*e^(2*I*x) - 2)^2 + 64*cos(2*x)^3 + 32*(cos(2*x)^2 + 2*cos(2*x) + 1)*sin(2*
x)^2 + 96*cos(2*x)^2 + 64*cos(2*x) + 16)^(1/4)*sin(2*x)*sin(1/2*arctan2(8*(cos(2*x) + 1)*sin(2*x)/abs(2*e^(2*I
*x) - 2)^2, (abs(2*e^(2*I*x) - 2)^2 + 4*cos(2*x)^2 - 4*sin(2*x)^2 + 8*cos(2*x) + 4)/abs(2*e^(2*I*x) - 2)^2)) +
 4*cos(2*x)^2 + 4*sin(2*x)^2 + 8*cos(2*x) + 4)/abs(2*e^(2*I*x) - 2)^2)

Giac [F(-1)]

Timed out. \[ \int \sqrt {-1+\cot ^2(x)} \, dx=\text {Timed out} \]

[In]

integrate((-1+cot(x)^2)^(1/2),x, algorithm="giac")

[Out]

Timed out

Mupad [B] (verification not implemented)

Time = 13.92 (sec) , antiderivative size = 34, normalized size of antiderivative = 0.81 \[ \int \sqrt {-1+\cot ^2(x)} \, dx=\sqrt {2}\,\mathrm {atanh}\left (\frac {\sqrt {2}\,\mathrm {cot}\left (x\right )}{\sqrt {{\mathrm {cot}\left (x\right )}^2-1}}\right )-\ln \left (\mathrm {cot}\left (x\right )+\sqrt {{\mathrm {cot}\left (x\right )}^2-1}\right ) \]

[In]

int((cot(x)^2 - 1)^(1/2),x)

[Out]

2^(1/2)*atanh((2^(1/2)*cot(x))/(cot(x)^2 - 1)^(1/2)) - log(cot(x) + (cot(x)^2 - 1)^(1/2))